import 'package:high_help_apps/common/entities/misc/email/auth_email_request_entity.dart';
import 'package:high_help_apps/common/entities/misc/email/auth_email_response_entity.dart';
import 'package:high_help_apps/common/entities/misc/email/send_email_response_entity.dart';
import 'package:high_help_apps/common/utils/http.dart';

/// FileName: email
/// Author: admin
/// Date: 2021-07-31 16:45
/// Description:

class EmailAPI {
  /// 发送邮箱验证码
  static Future send(String email) async {
    var response =
        await HttpUtil().get('/auth/email', queryParameters: {'email': email});
    return SendEmailResponseEntity().fromJson(response);
  }

  /// 验证邮箱验证码
  static Future auth({AuthEmailRequestEntity? params}) async {
    var response = await HttpUtil()
        .post('/auth/post', data: params?.toJson());
    print(response);
    return AuthEmailResponseEntity().fromJson(response);
  }
}
